﻿using Com.JunCaiSoft.Common.Enums;
using Com.JunCaiSoft.Common.ExchangeData;
using Com.JunCaiSoft.Common.Struct;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Com.JunCaiSoft.Common.IDao
{
    public interface IQueryWithPageDaoAsync<T> where T : class, new()
    {
        Task<QueryData<T>> ListByPageAsync<TKey>(Expression<Func<T, TKey>> orderBy, int pageIndex, int pageSize, OrderbyType orderType = OrderbyType.ase);
        Task<QueryData<T>> ListByPageAsync<TKey>(Expression<Func<T, bool>> where, Expression<Func<T, TKey>> orderBy, int pageIndex, int pageSize, OrderbyType orderType = OrderbyType.ase);
        Task<QueryData<T>> ListByPageAsync(Expression<Func<T, bool>> condition, int pageIndex, int pageSize, params OrderModelField[] orderByExpression);

        Task<QueryData<TEntity>> ListByPageAsync<TEntity, TKey>(Expression<Func<TEntity, TKey>> orderBy, int pageIndex, int pageSize, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        Task<QueryData<TEntity>> ListByPageAsync<TEntity, TKey>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TKey>> orderBy, int pageIndex, int pageSize, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        Task<QueryData<TEntity>> ListByPageAsync<TEntity>(Expression<Func<TEntity, bool>> condition, int pageIndex, int pageSize, params OrderModelField[] orderByExpression) where TEntity : class, new();

        Task<QueryData<TEntity>> QuerySQLByPageAsync<TEntity>(int pageIndex, int pageSize, string sql, params object[] parameters) where TEntity : class, new();
        Task<QueryData<TEntity>> QuerySQLByPageQuickAsync<TEntity>(int pageIndex, int pageSize, string orderBy, string colums = null, string tables = null, string where = null, params object[] parameters) where TEntity : class, new();
    }
}
